home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / PCHDT_E3.CAB / rcBuddy.cab / RAServer.js < prev    next >
Encoding:
Text File  |  2003-03-24  |  4.9 KB  |  207 lines

  1. var L_STOPTALKING_Text = "Stop <U>T</U>alking";
  2. var L_STARTTALKING_Text = "Start <u>T</u>alking";
  3. var L_LASTCHAT_Text = "Last message received at ";
  4. var L_ERRRCSESSION_Text = "Failed to destroy RCSession";
  5. var L_ERRNULLRCSESSION_Text = "A program has stopped responding.Please try again.";
  6. var L_RCCTL_Text = "Remote Assistance failed. Please try again. ";
  7. var L_ERRVOIP2_Text = "The necessary hardware and/or configuration to use a voice connection is not available;'Start Talking' will be disabled for the remainder of this Remote Assistance session.";
  8. var g_Helpee_oSAFRemoteDesktopSession = null;
  9. var g_Helpee_oSAFRemoteDesktopChannelMgr = null;
  10. var g_Helpee_oChatChannel = null;
  11. var g_Helpee_oControlChannel = null;
  12. var g_Helpee_oSAFIntercomServer = null;
  13. var g_bVoIPEnabled = true;
  14. var g_objPanic = null;
  15. function InitVoIP()
  16. {
  17. if( true == g_bVoIPEnabled )
  18. {
  19. g_Helpee_oSAFIntercomServer = oSAFClassFactory.CreateObject_IntercomServer();
  20. g_Helpee_oSAFIntercomServer.onVoiceDisconnected = Helpee_onVoiceDisconnected;
  21. g_Helpee_oSAFIntercomServer.onVoiceConnected = Helpee_onVoiceConnected;
  22. g_Helpee_oSAFIntercomServer.onVoiceDisabled = Helpee_onVoiceDisabled;
  23. }
  24. }
  25. function Init_Helpee_SALEM()
  26. {
  27. ;
  28. if(null == g_Helpee_oSAFRemoteDesktopSession)
  29. {
  30. FatalError( L_ERRNULLRCSESSION_Text );
  31. }
  32. else
  33. {
  34. try
  35. {
  36. g_Helpee_oSAFRemoteDesktopChannelMgr = g_Helpee_oSAFRemoteDesktopSession.ChannelManager;
  37. g_Helpee_oChatChannel = g_Helpee_oSAFRemoteDesktopChannelMgr.OpenDataChannel( "70" );
  38. g_Helpee_oControlChannel = g_Helpee_oSAFRemoteDesktopChannelMgr.OpenDataChannel( "71" );
  39. g_Helpee_oChatChannel.OnChannelDataReady = function()
  40. { Helpee_ChatChannelDataReadyEventHandler(); }
  41. g_Helpee_oControlChannel.OnChannelDataReady = function()
  42. { Helpee_ControlChannelDataReadyEventHandler(); }
  43. g_Helpee_oSAFRemoteDesktopSession.OnDisconnected = function()
  44. { Helpee_OnClientDisconnectedEventHandler(); }
  45. }
  46. catch(error)
  47. {
  48. FatalError( L_ERRFATAL_Text, error );
  49. }
  50. }
  51. ;
  52. return;
  53. }
  54. function Helpee_onVoiceDisconnected()
  55. {
  56. ;
  57. try
  58. {
  59. if (true == g_bConnected)
  60. {
  61. g_bVoipConnected = false;
  62. g_bStartEnabled = true;
  63. if (g_bVoIPEnabled == true)
  64. {
  65. frames.idFrameTools.btnVoice.disabled = false;
  66. frames.idFrameTools.txtVoice.disabled = false;
  67. frames.idFrameTools.txtVoice.innerHTML = L_STARTTALKING_Text;
  68. }
  69. }
  70. }
  71. catch (error)
  72. {
  73. }
  74. ;
  75. }
  76. function Helpee_onVoiceConnected()
  77. {
  78. ;
  79. try
  80. {
  81. g_bVoipConnected = true;
  82. g_bStartEnabled = true;
  83. frames.idFrameTools.txtVoice.innerHTML = L_STOPTALKING_Text;
  84. frames.idFrameTools.btnVoice.disabled = false;
  85. frames.idFrameTools.txtVoice.disabled = false;
  86. }
  87. catch (error)
  88. {
  89. }
  90. ;
  91. }
  92. function Helpee_onVoiceDisabled()
  93. {
  94. ;
  95. try
  96. {
  97. if (g_bVoIPEnabled == true)
  98. {
  99. g_bVoIPEnabled = false;
  100. g_bVoipConnected = false;
  101. DisplayMessage(L_ERRVOIP2_Text);
  102. frames.idFrameTools.btnVoice.disabled = true;
  103. frames.idFrameTools.txtVoice.disabled = true;
  104. g_stateVoipMe = 2;
  105. Helpee_SendControlCommand( "DISABLEVOICE" );
  106. }
  107. }
  108. catch (error)
  109. {
  110. FatalError( L_RCCTL_Text, error );
  111. }
  112. ;
  113. }
  114. function Helpee_ChatChannelDataReadyEventHandler()
  115. {
  116. ;
  117. var data = null;
  118. try
  119. {
  120. data = g_Helpee_oChatChannel.ReceiveChannelData();
  121. idCtx.minimized = false;
  122. idCtx.bringToForeground();
  123. SoundBeep();
  124. if(true == g_bChatBoxHidden)
  125. {
  126. frames.idFrameTools.Helpee_HideChat();
  127. }
  128. frames.idFrameChatTop.UpdateChatHistory( data );
  129. frames.idFrameTools.UpdateChatStatus( L_LASTCHAT_Text );
  130. frames.idFrameChatTop.SetFocus();
  131. }
  132. catch(error)
  133. {
  134. FatalError( L_ERRFATAL_Text, error );
  135. }
  136. ;
  137. return;
  138. }
  139. function DisplayDisconnectStatus()
  140. {
  141. ;
  142. try
  143. {
  144. frames.idFrameTools.UpdateStatus( L_HELPEEDISCONNECTED_Text );
  145. parent.gDisconnected = true;
  146. }
  147. catch(error)
  148. {
  149. FatalError( L_RCCTL_Text, error );
  150. }
  151. ;
  152. return;
  153. }
  154. function Helpee_OnClientDisconnectedEventHandler()
  155. {
  156. ;
  157. try
  158. {
  159. SoundBeep();
  160. g_bConnected = false;
  161. try
  162. {
  163. if (g_bVoipConnected == true)
  164. {
  165. g_Helpee_oSAFIntercomServer.Disconnect();
  166. }
  167. if(null != parent.oRCSession)
  168. {
  169. parent.oRCSession.Disconnect();
  170. parent.oRCSession.onDisconnected = function()
  171. { }
  172. parent.oRCSession.onConnected = function( salemID, userSID, sessionID )
  173. { }
  174. }
  175. }
  176. catch(error)
  177. {
  178. }
  179. DisplayDisconnectStatus();
  180. ;
  181. ;
  182. idBody.disabled = true;
  183. frames.idFrameChatTop.idchatText.disabled = true;
  184. frames.idFrameChatTop.btnSendChat.disabled = true;
  185. frames.idFrameChatTop.idIncomingChatText.disabled = false;
  186. frames.idFrameTools.idBody.disabled = true;
  187. CloseOpenSubWin();
  188. if( false == g_bUserDisconnect )
  189. {
  190. if (null != g_objPanic)
  191. {
  192. g_objPanic.ClearPanicHook();
  193. }
  194. if ( (null == parent.gHelperName ) || ( parent.gHelperName.length == 0 ))
  195. {
  196. parent.gHelperName = L_DEFAULTUSER_Text;
  197. }
  198. var vArgs = new Array(1);
  199. vArgs[0] = L_ERRDISCONNECT1_Text + parent.gHelperName + L_ERRDISCONNECT2_Text + parent.gHelperName + ".";
  200. var vRetVal = window.showModelessDialog( "hcp://system/Remote Assistance/Interaction/Common/ErrorMsgs.htm", vArgs, "dialogwidth:405px;dialogHeight:165px;status:no;resizable:no;help:no" );
  201. }
  202. }
  203. catch(error)
  204. {
  205. }
  206. }
  207.